<template>
  <div class="all">
    <van-nav-bar
      fixed
      placeholder
      safe-area-inset-top
      title="联系客服"
      left-arrow
      @click-left="back"
    />
    <div class="content">
      <div class="notice">
        <div class="chat">
          <div class="cell" @click="customerservice">
            <img src="../../assets/chatimg02.png" class="header">
            <div class="name">
              <div>暖暖客服</div>
              <div>工作时间：周一至周五 09:00-18:00</div>
            </div>
            <div style="flex: 1" />
            <div>&emsp;</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getService } from '../../apis/user.js'
export default {
  data() {
    return {
      targetId: null
    }
  },
  created() {
    getService({}).then((res) => {
      if (res.code === 201) {
        this.targetId = res.result.targetId
      }
    })
  },
  methods: {
    back() {
      this.$router.go(-1)
    },
    customerservice() {
      if (this.targetId) {
        this.$router.push({
          path: '/customerservice',
          query: { targetId: this.targetId }
        })
      } else {
        this.$toast('获取客服失败')
      }
    }
  }
}
</script>

<style lang="less" scoped>
.all {
  height: 100%;
  background-color: #f2f2f2;
}
.content {
  padding: 15px;
  .notice {
    background-color: #fff;
    border-radius: 15px;
    width: 345px;
  }
  .tips {
    margin: 20px 0;
    text-align: center;
    font-size: 13px;
    color: #999;
  }
  .chat {
    background-color: #fff;
    border-radius: 15px;
    .cell {
      padding: 15px;
      font-size: 13px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .header {
        width: 35px;
        height: 35px;
      }
      .name {
        margin-left: 15px;
        div {
          &:first-child {
            font-size: 15px;
            font-weight: bold;
            color: #333;
          }
          &:last-child {
            margin-top: 5px;
            font-size: 12px;
            color: #666;
          }
        }
      }
    }
  }
}
</style>
